//
//  PhotoViewController.h
//  Dispatch
//
//  Created by hyeyeon on 14. 1. 21..
//  Copyright (c) 2014년 hyeyeon. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import <Social/Social.h>
#import <Accounts/Accounts.h>

#import "AppDelegate.h"
#import "ViewController.h"
#import "PhotoScrollView.h"
#import "SaveImgViewController.h"
#import "IssueView.h"
#import "NewsViewController.h"

//sns
#import <Twitter/Twitter.h>
#import <FacebookSDK/FacebookSDK.h>
#import <CoreLocation/CoreLocation.h>
#import "KakaoLinkCenter.h"


//ad
#import "ManBreakAdView.h"




typedef enum {
    RequestNone,
    RequestNext,
    RequestPrevious
}RequestType;

@interface PhotoViewController : UIViewController <UIScrollViewDelegate,UIActionSheetDelegate, ManBreakAdViewDelegate, FBLoginViewDelegate>
{
    AppDelegate *appDelegate;
    
    //ui
    PhotoScrollView *mScrollView;
    UIView *titleView;
    UIView *bottomView;
    UIView *contentView;
    UIButton *leftArrowButton;
    UIButton *rightArrowButton;
    UIButton *upButton;
    UIButton *downButton;
    UILabel *upCountLabel;
    UILabel *downCountLabel;
    UILabel *winCountLabel;
    UILabel *loseCountLabel;
    UIView *bottomWinView;
    UIView *bottomLoseView;
    UILabel *rankingLabel;
    CGRect thirdBtnRect;
    
    
    //title
    UILabel *titleLabel;    //기사제목
    UIButton *starButton;   //스타이름버튼
    UILabel *starNameLabel;
    UIImageView *goStarImage;
    
    //원문보기
    UILabel *dateLabel; //날짜
    UITextView *contentTextView;
    
    //scroll
    UIView *firstView;
    UIView *secondView;
    UIView *thirdView;
    UIImageView *fImage;
    UIImageView *sImage;
    UIImageView *tImage;
    float currentScrollContentSize;
    
    //데이타
    NSMutableArray *dataList;   //issue.php
    NSMutableArray *imageList;  //현재 기사의 이미지(UIImage) 리스트
    NSInteger loadIndex;
    NSMutableDictionary *mImageDic;
    
    //네트워크
    BOOL duringNetwork;
    RequestType requestType;
    NSInteger currentImageIndex;
    NSInteger requestIndex; //1:데이타, 2:올려내려
    
    //zoom
    BOOL zooming;
    
    //ad
    ManBreakAdView *manBreak;
    BOOL requestAD;
    BOOL mComeLeft;
    
    //광고띄울라면
    BOOL nextPageIsMan;         //담페이지는 광고
    BOOL prevPageIsMan;         //전페이지는 광고
    NSInteger currentAdCount;   //광고띄울차례 알아내기 위해 카운트셈
    BOOL appearAD;
    
    //sns:facebook
    BOOL enableFacebook;
    

    //업다운한거 임시저장
    NSMutableDictionary *upDownTSDic;
    
    UIActivityIndicatorView *mActivityView;
    
}
@property (nonatomic, assign) id mDelegate;
@property (nonatomic,retain) NSArray *issuesList;               //issues.php
@property (nonatomic,assign) NSInteger issueLastIndex;        //이슈인덱스 (마지막)
@property (nonatomic, assign) NSInteger issueFirstIndex;        //이슈인덱스 (맨앞)
@property (nonatomic, assign) NSInteger currentImageIndex;      //현재이미지의 인덱스
@property (nonatomic,assign) BOOL typeHotIssue;
@property (nonatomic, assign) NSInteger adCount;
@property (nonatomic, assign) NSInteger currentAdCount;
@property (nonatomic, retain) NSString *dateString;

//네트워크
@property (nonatomic, strong) NSMutableData *responseData;  //네트워크를 통해 받을 데이타
@property (nonatomic, retain) NSString *imageURL;
@property (nonatomic, retain) NSString *currentDate;

@property (nonatomic,retain) UIView *secondView;

//parent 클래스
@property (nonatomic,assign) NSInteger parentClassIndex;    //1:배틀외 2:배틀 3:사진만 4:스키마+이슈 5:검색 6:스타랭킹

//sns
@property (nonatomic,retain) TWTweetComposeViewController *mTwitter;


//통계따위땜에 변수만듦
@property (nonatomic, retain) NSString *analyticsAction;
@property (nonatomic, retain) NSString *analyticsLabelDetail;
@property (nonatomic, retain) NSString *analyticsLabelWhole;

//초기 데이타 설정
-(void)setIssueIndex:(NSInteger)index;
-(void)requestIssueID:(NSString*)issueID;
-(void)requestBattleWithDate:(NSString*)date andStarID:(NSString*)starID;

//전면보기or캡션보기
-(void)changeFullScreen;

//사진에서만 볼때
-(void)setOnePhotoImage:(NSDictionary*)dic;

//푸쉬에서 넘어올때요청
-(void)requestIssueID:(NSString*)issueID andPushID:(NSString*)pushID;

//스타에서 넘어올때
-(void)settingDataFromStar:(NSArray*)starArray;

//이미지 입힘
-(void)settingToPhotoDataWithArray:(NSArray*)items;
@end
